package com.uglyboys.adapter;

import java.util.List;

import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.uglyboys.R;
import com.uglyboys.model.Frase;

public class FraseArrayAdapter extends ArrayAdapter<Frase>{
	private final Context context;
	private final List<Frase> values;
	public int count;
	public List<Frase> getValues() {
		return values;
	}
	

	public Context getContext() {
		return context;
	}


	public FraseArrayAdapter(Context context, List<Frase> values) {
		super(context, R.layout.layout_frases, values);
		this.context = context;
		this.values = values;
		count = values.size();
	}
	
	
	@Override
	public void clear() {
		this.values.clear();
		super.clear();
	}
	
	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.layout_frases, parent, false);
		
		TextView textFrase = (TextView) rowView.findViewById(R.id.textFrase);
		final Frase frase = values.get(position);
		textFrase.setText(Html.fromHtml(frase.getFrase()));
//		textFrase.setTextSize(Constantes.FONTE_GRANDE);
		
		return rowView;
	}
	
}
